import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/login",
      name: "登录",
      component: () => import("../login/login.vue"),
      meta: {
        showfater: true
      },
      children: [
        {
          path: "/register",
          name: "注册",
          component: () => import("../login/register.vue"),
          meta: {
            showfater: false
          }
        }
      ]
    },
    //设置登录为首页
    {
      path: '/:pathMatch(.*)',
      redirect: '/login'
    },
    {
      path: "/index/:username",
      component: () => import("../Main/index.vue"),
      meta: {
        showfater: true
      },
      children: [
        {
          path: "/BaseInfo",
          name: "医生信息",
          component: () => import("../Main/BaseInfo.vue"),
          meta: {
            showfater: false
          }

        },
        {
          path: "/PatientInfo",
          name: "患者信息",
          component: () => import("../Main/PatientInfo.vue"),
          meta: {
            showfater: false
          }

        },
        {
          path: "/Patientout",
          name: "病人队列",
          component: () => import("../Main/Patientout.vue"),
          meta: {
            showfater: false
          }

        },
        {
          path: "/Fail",
          name: "无权",
          component: () => import("../Main/Fail.vue"),
          meta: {
            showfater: false
          }

        },
        {
          path: "/CheckReco",
          name: "检查推荐",
          component: () => import("../Main/CheckReco.vue"),
          meta: {
            showfater: false
          }

        },
        {
          path: "/DiseaseCategory",
          name: "疾病所属项目",
          component: () => import("../Main/DiseaseCategory.vue"),
          meta: {
            showfater: false
          }

        },
        {
          path: "/questionnaire",
          name: "调查问卷",
          component: () => import("../Main/questionnaire.vue"),
          meta: {
            showfater: false
          }

        },
        {
          path: "/PEPManage",
          name: "检查管理",
          component: () => import("../Main/PEPManage.vue"),
          meta: {
            showfater: false
          }

        },

        {
          path: "/CustomerService",
          name: "智能客服",
          component: () => import("../Main/CustomerService.vue"),
          meta: {
            showfater: false
          }

        },
      ]
    },
  ]

})
// router.beforeEach((to, from, next) => {
//   // 路由导航前的逻辑
//   next();
// });
export default router
